package br.com.ac.fatureweb.view;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.faces.event.ActionEvent;
import javax.faces.view.ViewScoped;
import javax.inject.Inject;
import javax.inject.Named;

import br.com.ac.fatureweb.model.Perfil;
import br.com.ac.fatureweb.service.NgcPerfilBean;
import br.com.ac.fatureweb.utilitary.CrudDefaultBean;
import br.com.ac.fatureweb.utilitary.EnumStatusManaged;

@Named
@ViewScoped
public class PerfilBean extends CrudDefaultBean<Perfil, NgcPerfilBean> {

	/**
	 * 
	 */
	private static final long serialVersionUID = -5335159986601600944L;

	private List<Perfil> lstPerfil;

	@Inject
	private NgcPerfilBean ngcPerfilBean;

	@PostConstruct
	public void inicialize() {
		setService(ngcPerfilBean);
	}

	public void adicionar(ActionEvent event) {
		try {
			if (lstPerfil == null) {
				lstPerfil = new ArrayList<Perfil>();
			}

			lstPerfil.add(new Perfil());

			setCurrentState(EnumStatusManaged.INCLUIR);

			// Thread.sleep(10000);
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

	public List<Perfil> getLstPerfil() {
		return lstPerfil;
	}

	public void setLstPerfil(List<Perfil> lstPerfil) {
		this.lstPerfil = lstPerfil;
	}

}
